﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ZiDingYiKj
{
    public class ComBoxUser: ComboBox
    {
        private bool _ReadOnle;

        public ComBoxUser()
        {
            this._ReadOnle = true;
            this.DropDownStyle = ComboBoxStyle.DropDownList;
            this.TabStop = false;
        }

        public bool ReadOnly
        {
            get
            {
                return this._ReadOnle;
            }
            set
            {
                this._ReadOnle = value;
            }
        }

        protected override void WndProc(ref Message m)
        {
            if (this._ReadOnle && (m.Msg == 0xa1 || m.Msg == 0x201 || m.Msg == 0x203))
            {
                return;
            }
            base.WndProc(ref m);
        }
    }
}
